﻿using Model.Battle;
using SanZhan.Models.Cards.ZhanFa;
using SanZhan.Models.User;

namespace Model.ZhanFa
{
    public class Putonggongji : ZhanFaBase
    {
        public Putonggongji()
        {
            ID = 1;
            Name = "普通攻击";
            Type = ZhanFaType.pugong;
            Rate = 1;
            Description = "普通攻击";
        }
        /*
        public override void OP(FightBase fightBase)
        {
            UserWuJiang wujiang = fightBase.CurrWuJiang;
            UserWuJiang target = GetTarget(wujiang, fightBase.team1, fightBase.team2);
            decimal baseharm = ZhanFaCPU.BingrenBaseHarm(wujiang.Bingli, wujiang.Wuli, target.Tongshuai);
            int harm = Convert.ToInt32(Math.Floor(baseharm * wujiang.ZaoChengBingrenShangHai * target.ShowDaoBingrenShangHai));
            int hurt = Convert.ToInt32(Math.Floor(baseharm * 0.9M));
            int dead = harm - hurt;
            target.Bingli -= harm;
            if (target.Bingli < 0)
            {
                target.Bingli = 0;
            }
            target.ShangBing += hurt;
            fightBase.infos.Add($"[{target.heroBase.Name}]损失了兵力{harm}（{target.Bingli}）");
        }
        */
        public UserWuJiang GetTarget(UserWuJiang wujiang, UserTeam userTeam1, UserTeam userTeam2)
        {
            var wujiangs = new List<UserWuJiang> { userTeam2.ZhuJiang, userTeam2.FuJiang1, userTeam2.FuJiang2 };
            var target = wujiangs.Where(x => x.Alive && x.UserTeam.TeamSide != wujiang.UserTeam.TeamSide).OrderBy(x => Guid.NewGuid()).First();
            return target;
        }

        public void OP(BattleInfo battleInfo)
        {
            throw new NotImplementedException();
        }
    }
}
